# This scipt can change a block in a file.
import my_function as my
# block_head is a word without = and {
block_head = "diff_very_hard_ai"
file_path = r"E:\SteamLibrary\steamapps\common\Hearts of Iron IV\common\modifiers\00_static_modifiers.txt"
new_block_content = block_head + """ = {
    no_supply_grace = 36
    political_power_gain  = 10
    # ai_focus_aggressive_factor = 100
    repair_speed_factor = 5000
    justify_war_goal_time = -0.99
    # war_support_weekly = -1
    # war_support_factor = -10000
    surrender_limit = -1000
    # command_power_gain_mult = 10
    # max_command_power = 500
    foreign_subversive_activites = 100
    army_speed_factor = 2
    # army_morale_factor = 2
    # supply_consumption_factor = -0.99
    air_accidents = 1000
}"""

my.replace_block(file_path, block_head, new_block_content)
# print(new_block_content)

block_head = "diff_very_hard_player"
file_path = r"E:\SteamLibrary\steamapps\common\Hearts of Iron IV\common\modifiers\00_static_modifiers.txt"
new_block_content = block_head + """ = {
	no_supply_grace = 36
    political_power_gain  = 10
    army_core_defence_factor = 10
	air_range_factor = 20
    # repair_speed_factor = 5000
    justify_war_goal_time = -0.99
    command_power_gain_mult = 10
    max_command_power = 500
    subversive_activites_upkeep = -0.99
    # operation_cost = -1.0 #行动花费减少
    # operation_infiltrate_outcome = 100.0 #渗透效率增加
    # operation_outcome = 100.0 #行动效率增加
    army_speed_factor = 2
    # army_morale_factor = 2
    industrial_capacity_factory = 10000
    industrial_capacity_dockyard = 10000
    # supply_consumption_factor = -0.99
    air_accidents = 1000
}"""

my.replace_block(file_path, block_head, new_block_content)